#include<stdio.h>
/**
 * The prime 41, can be written as the sum of six consecutive primes:
 * 41 = 2 + 3 + 5 + 7 + 11 + 13
 * This is the longest sum of consecutive primes that adds to a prime below one-hundred.
 * The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953.
 * Which prime, below one-million, can be written as the sum of the most consecutive primes?
 */


/* 2010-06-07 */

int primes[1000000];

int main(void)
{
  FILE *primes_arr = fopen("primes1000000", "r");
  int max = 0;
  int i = 0, j = 0, count, tmp;
  int sum = 0;

  while( fscanf(primes_arr, "%d", &primes[max++]) != EOF);
  /*
  for(i=0; i < 100 ;i++)
    printf("%d\n", primes[i]);
  */
  
  for(i=200; i<600; i++) {
    sum = 0;
    for(j=3; j<i+3; j++) {
      sum += primes[j];
    }
    if( sum > 1000000) {
      continue;
    } 
    else { 
      count = i;
      tmp = sum;
    }
  }
  printf("%d %d\n", tmp, count);
  
  return 0;
}
  
